<template>
    <div>
        <button>返回</button>
        <span>{{ title }}</span>
        <button>首页</button>
    </div>
</template>

<script>
import store from './store.js';
export default {
    data(){
        return {
            title:'首页'
        }
    },
    mounted(){
        //订阅状态变化
        store.subscribe((val)=>{
            console.log('订阅状态变化',val);
            this.title = val
        })
    }

}
</script>

<style scoped>
    div{
        display: flex;
        width: 100%;
        height: 50px;
        justify-content: space-between;
        align-items: center;
        background-color: skyblue;
    }
</style>